package com.boot.schedule;

import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.time.LocalDateTime;

/**
 * @author songyake
 * @Date: 2023/04/10
 */
@EnableScheduling
@Component
public class ScheduledTest {

    @Scheduled(cron = "0/2 * * * * ?")
    public void t2() throws InterruptedException {
        Thread.sleep(300000);
        System.out.println(Thread.currentThread().getName() + "===t2===" + LocalDateTime.now());
    }

    @Scheduled(cron = "0/2 * * * * ?")
    public void t21() throws InterruptedException {
        Thread.sleep(3000);
        System.out.println(Thread.currentThread().getName() + "===t22===" + LocalDateTime.now());
    }

}
